package com.bdqn.tour.dao.impl;

import com.bdqn.tour.dao.BaseDao;
import com.bdqn.tour.dao.GyhDeleteUserInfoDao;

/**
 * 删除用户信息实现类
 */
public class GyhDeleteUserInfoDaoImpl extends BaseDao implements GyhDeleteUserInfoDao {

    /**
     * 删除用户信息
     * @param id 用户id
     * @return 返回row 删除行数
     */
    @Override
    public int deleteUserInfo(int id) {
        //1. 返回对象
        int row = 0;
        //2. 打开连接
        this.conn = this.getConnection();
        //3. 准备SQL
        String sql = "delete from user where id = ?";
        //4. 预编译
        try {
            row = this.executeUpdate(sql,id);
        } catch (Exception e) {
            throw new RuntimeException(e);
        }finally {
            //释放资源
            this.closeAll(conn,psmt,rs);
        }

        return row;
    }
}
